-- remote_burn_mp
-- created by zhuangsl
-- 远程攻击燃烧目标魔法值

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 远程攻击时触发
    trigger = function(who, prop, arg)
        local target = arg;

        -- 耗蓝
        local base = 12;
        local force = prop[3];
        local mp = target:getMp();
        local curr_floor = DungeonM.currentLayer();
        
        local value1 = who:getAttack();
        local value2 = math.modf(base + curr_floor * force / 1000);
        local value = math.min(2 * value1, value2);

        -- 效果被减弱
        local p = PropM.combine(target, "reduce_negative", "burn_mp");
        value = PropM.apply(p, value);

        if mp < value then
            value = mp;
        end
        
        -- 保护一下
        value = math.max(value, 0);
        
        target:costAttrib("mp", value);

        return value;
    end,

    record = function(target, prop, path)
        return false;
    end
};
